package FlyGame;

import javax.swing.*;
import java.awt.*;

public class MyFruit {
    public int fruitx;
    public int fruity;
    public int fruith;
    public int fruitw;
    public Rectangle fruitrect;
    public MyFruit(){
        fruitrect=new Rectangle();
        fruitx= (int) (250+Math.random()*50);
        fruity= (int) (150+Math.random()*50);
        fruith=FlyPicture.Fruit.getIconHeight();
        fruitw=FlyPicture.Fruit.getIconWidth();
    }
    public Rectangle getRectangle(){
        return fruitrect;
    }
    public void paintFruit(Graphics g, JPanel panel)
    {
        for (int i=0;i<50;i++)
        {
            FlyPicture.Fruit.paintIcon(panel,g,this.fruitx,this.fruity);
            this.fruitrect.x=this.fruitx;
            this.fruitrect.y=this.fruity;
            this.fruitrect.width=this.fruitw;
            this.fruitrect.height=this.fruith;
        }
    }

}